@extends('admin.container')

@section('c-body')
    @if(count($errors) > 0)
        <div class="am-g">
            <div class="am-u-md-12">
                @foreach($errors->all() as $error)
                    <div class="am-alert am-alert-warning" data-am-alert><button type="button" class="am-close">&times;</button><p>{{ $error }}</p></div>
                @endforeach
            </div>
        </div>
    @endif
    <div class="am-g">
        <div class="am-u-md-12">
            <form class="am-form am-form-horizontal" method="post" action="{{ route('admin.goods.brand.index') }}" enctype="multipart/form-data">
                {!! csrf_field() !!}
                <div class="am-form-group">
                    <label for="user-name" class="am-u-sm-3 am-form-label">品牌名称</label>
                    <div class="am-u-sm-9">
                        <input type="text" id="user-name" placeholder="品牌名称" name="name">
                     </div>
                </div>
                <div class="am-form-group am-form-file">
                    <label for="user-name" class="am-u-sm-3 am-form-label">品牌图片</label>
                    <div class="am-u-sm-3">
                        <button type="button" class="am-btn am-btn-default am-btn-sm">
                            <i class="am-icon-cloud-upload"></i> 选择要上传的文件</button>
                        <input type="file" name="logo" id="web_logo">
                    </div>
                    <div class="am-fl" id="file-list-web_logo"></div>
                </div>
                <div class="am-form-group">
                    <label for="user-name" class="am-u-sm-3 am-form-label">品牌描述</label>
                    <div class="am-u-sm-9">
                        <textarea name="description"></textarea>
                    </div>
                </div>
                <div class="am-form-group">
                    <label for="user-name" class="am-u-sm-3 am-form-label">推荐</label>
                    <div class="am-u-sm-9">
                        是<input type="radio" id="user-name" name="recommend" value="1">
                        否<input type="radio" id="user-name" name="recommend" value="0">
                    </div>
                </div>
                <div class="am-form-group">
                    <label for="user-name" class="am-u-sm-3 am-form-label">显示</label>
                    <div class="am-u-sm-9">
                        是<input type="radio" id="user-name" name="display" value="1">
                        否<input type="radio" id="user-name" name="display" value="0">
                    </div>
                </div>
                <div class="am-form-group">
                    <label for="user-name" class="am-u-sm-3 am-form-label">排序</label>
                    <div class="am-u-sm-9">
                        <input type="text" id="user-name" placeholder="排序大小" name="sort">
                    </div>
                </div>

                <div class="am-u-sm-9 am-u-sm-push-3">
                    <button type="submit" class="am-btn am-btn-primary am-radius">添加品牌</button>
                </div>
            </form>
        </div>
    </div>
@stop

@section('c-foot')
    <script>
        $(function() {
            $('#business_logo').on('change', function() {
                var fileNames = '';
                $.each(this.files, function() {
                    fileNames += '<span class="am-badge">' + this.name + '</span> ';
                });
                $('#file-list-business_logo').html(fileNames);
            });
            $('#member_logo').on('change', function() {
                var fileNames = '';
                $.each(this.files, function() {
                    fileNames += '<span class="am-badge">' + this.name + '</span> ';
                });
                $('#file-list-member_logo').html(fileNames);
            });
            $('#web_logo').on('change', function() {
                var fileNames = '';
                $.each(this.files, function() {
                    fileNames += '<span class="am-badge">' + this.name + '</span> ';
                });
                $('#file-list-web_logo').html(fileNames);
            });
        });
    </script>
@stop